package learn.builder.goodversion.peopledemo;

/**
 * Created By  醉美柳舞之众星捧月
 *
 * @author 宋贤坤
 * @date 2019/3/18 13:44
 */
public class SomePeopleBuilder {

    private String id;
    private String userName;
    private String pwd;
    private String email;

    public SomePeopleBuilder(NewBuild newBuild) {
        this.id = newBuild.id;
        this.pwd = newBuild.pwd;
        this.email = newBuild.email;
        this.userName = newBuild.userName;
    }

    public static class NewBuild {
        private String id;
        private String userName;
        private String pwd;
        private String email;

        public NewBuild buildId(String id) {
            this.id = id;
            return this;
        }

        public NewBuild buildUserName(String userName) {
            this.userName = userName;
            return this;
        }

        public NewBuild buildPwd(String pwd) {
            this.pwd = pwd;
            return this;
        }

        public NewBuild buildEmail(String email) {
            this.email = email;
            return this;
        }

        public SomePeopleBuilder build() {
            return new SomePeopleBuilder(this);
        }
    }
}
